#ifndef __FEVENT_DEFINE_H__
#define __FEVENT_DEFINE_H__

#include <stdbool.h>
#include <sys/epoll.h>

/* Defintion Socket Type */
typedef struct socket_t {
   int fd; 

   void* data;
}socket_t,*socket_ptr;
/* End Defintion Socket Type */

/* Defintion Read & Write function */
typedef int (*func_read_ptr)(socket_ptr ptr, void* arg);
typedef int (*func_write_ptr)(socket_ptr ptr, void* arg);
typedef int (*func_accept_ptr)(socket_ptr ptr, void* arg);
/* End Defintion Read & Write function */

/* Defintion fevent config Type */
typedef struct fevent_config_t {
    int      port;
    bool     reuse;
    uint64_t read_queue_size;
    uint64_t write_queue_size;
}fevent_config_t, *fevent_config_ptr;
/* End Defintion fevent config Type */

/* Defintion fevent Type */
typedef struct fevent_t {
    socket_ptr      origin_socket;

    func_accept_ptr accept_func;
    func_read_ptr   read_func;
    func_write_ptr  write_func;

    fevent_config_ptr config;

    int epoll_fd;
    /* The Epoll Event of origin_socket */
    struct epoll_event origin_event;
}fevent_t, *fevent_ptr;
/* End Defintion fevent Type */

#endif
